package behavior.interpreter.Jep;


import org.nfunk.jep.JEP;

public class JepDemo {

    public static void main(String[] args) {
        String expression = "本金*利率*时间";
        JEP jep = new JEP();
        jep.addVariable("本金", 10000);
        jep.addVariable("利率", 0.038);
        jep.addVariable("时间", 2);
        //解析表达式
        jep.parseExpression(expression);
        //计算结果
        Object result = jep.getValueAsObject();
        System.out.println(result);

    }
}
